<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.css" rel="stylesheet" />
		<script src="./js/app.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		好友请求列表
		<ul class="mui-table-view">
			<li class="mui-table-view-cell mui-media">
				<a href="javascript:;">
					<img class="mui-media-object mui-pull-left" src="photo.jpg">
					<div class="mui-media-body mui-pull-left" style="width: 250px;">
						幸福
						<p class="mui-ellipsis">能和心爱的人一起睡觉，是件幸福的事情；可是，打呼噜怎么办？</p>
					</div>
					<button id="accept_button" class="mui-pull-right" style="margin-top: 5px; background-color: #EEEEEE; color: #2AC845; border: none;">接受</button>
				</a>
			</li>
		</ul>
		<script src="js/mui.js"></script>
		<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.init();
			mui.plusReady(function () {
			    var accept_button = document.getElementById("accept_button");
				accept_button.addEventListener("tap", function () {
					mui.ajax(app.serverAddress + '/u/add_friend',{
						data:{
							id1: app.getGlobalUserInfo().id,
							id2: app.getFriendRequestList()
						},
						dataType:'jsonp',//服务器返回json格式数据
						type:'post',//HTTP请求类型
						headers:{'Content-Type':'application/json'},
						timeout:10000,//超时时间设置为10秒；
						success:function(data){
							mui.toast("添加好友");
						},
						error:function(xhr,type,errorThrown){
							
						}
					});
				});
			});
		</script>
	</body>

</html>
